HAL PLAY migration: list of applicable concepts

This section provides information about the applicable HAL PLAY architecture concepts.

Concepts for PLAY

Concept

Description

Separation of initialization and configuration functions

The HAL1 PLAY driver is already split into initialization and configuration functions according to the following:

  • HAL_PLAY_Init(): initializes the handle and links it to a PLAY instance.

  • HAL_PLAY_INPUT_SetConfig(): configures the input multiplexers.

  • HAL_PLAY_LUT_SetConfig(): configures the lookup tables.

  • HAL_PLAY_OUTPUT_SetConfig(): configures the output multiplexers.

The HAL2 continues splitting according to this and additionally allows providing the instance within the HAL_PLAY_Init().

Renaming of the handle structure

The handle structure has been renamed to hal_play_handle_t.

Remove MspInit and MspDeInit callbacks

HAL_PLAY_MspInit() and HAL_PLAY_MspDeInit() are no longer available. They have to be replaced by a user-defined sequence to initialize and configure the PLAY.

Introduction of HAL user data set/get APIs

Two functions to set/get user data are available: HAL_PLAY_SetUserData() and HAL_PLAY_GetUserData().

Individual callback registration APIs replace global register and unregister functions

The registration of callbacks for PLAY events is managed by dedicated functions. Each function is responsible for registering callback functions for specific PLAY events.

HAL implementation with LL inline functions

HAL PLAY APIs now rely on LL APIs rather than performing direct register access.

Define statements and enumerations redirected to LL equivalents

HAL PLAY define statements and enumerations are based on LL define statements.

Removal of hardware-related macros in HAL2

All hardware macros have been removed from the HAL PLAY driver, and equivalent services are ensured through the LL APIs.

Revised and optimized HAL state machine

The PLAY is now managed by a global state machine.

Revised and optimized HAL API status returns

The HAL PLAY functions were updated to return:

  • HAL_INVALID_PARAM: in case of a NULL p_config structure pointer.

  • HAL_ERROR: in case of an error.

  • HAL_TIMEOUT: in case of a user timeout.

  • HAL_BUSY: in case of an ongoing process.

  • HAL_OK: in case of a successfully completed operation.

Revised and optimized HAL error management

The error handling mechanisms within the HAL have been redesigned to enhance the detection, reporting, and management of errors.

Replaced TypeDef suffix with _t in type names

All TypeDef parts in PLAY have been removed and replaced by _t.

Assertion implementation and usage in HAL1

The ASSERT_DBG_STATE and ASSERT_DBG_PARAM macros are used to check the parameters and state of the HAL PLAY driver.

Remove stm32tnxx_ll_ppp.c files

The source file stm32_ll_play.c has been removed.

Add HAL PPP Services for Drivers with Handle to Retrieve Corresponding Peripheral Clock Frequency.

The HAL PLAY driver provides a new function to retrieve the clock frequency: HAL_PLAY_GetClockFreq.

Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.

Finite parameters (including PLAY instances) have been converted into enumerated types (enums) at the HAL level. This improves code readability, maintainability, and type safety.

Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions).

All HAL PLAY functions start with HAL_PLAY_.